package com.ygo.feihua.adapter;
import android.content.*;
import android.os.*;
import android.support.v7.widget.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import android.widget.AdapterView.*;
import com.msk86.ygoroid.*;
import com.qnw.CardGroupManagement.*;
import com.ygo.feihua.*;
import com.ygo.feihua.service.*;
import com.ygo.feihua.util.*;
import java.util.*;

import android.view.View.OnClickListener;

public class AdapterBankuai extends RecyclerView.Adapter<AdapterBankuai.ViewHolder>
{

	

	private List<Map<String,Object>> data =new ArrayList<Map<String,Object>>();
	private Context context;
	List<Map<String,Object>> li=new ArrayList<Map<String,Object>>();
	private Gongju gj;
	private DialogUtils du;
	
	public AdapterBankuai(Context context,List<Map<String,Object>> data){
		this.context=context;
		this.data=data;
		gj=Gongju.getdx(context);
		du=DialogUtils.getdx(context);
	}
	
	class ViewHolder extends RecyclerView.ViewHolder{
		
		TextView bk_title;
		RecyclerView bk_grid;
		
		public ViewHolder(View v){
			super(v);
			bk_title=(TextView) v.findViewById(R.id.bk_title);
			bk_grid=(RecyclerView) v.findViewById(R.id.bk_rec);
			GridLayoutManager gl=new GridLayoutManager(context,4){
				public boolean canScrollVertically(){
					return false;
				}
			};
			bk_grid.setLayoutManager(gl);		
		}
	}
	
	@Override
	public AdapterBankuai.ViewHolder onCreateViewHolder(ViewGroup p1, int p2)
	{
		View v=LayoutInflater.from(p1.getContext()).inflate(R.layout.item_bankuai,p1,false);
		
		// TODO: Implement this method
		return new ViewHolder(v);
	}

	@Override
	public void onBindViewHolder(AdapterBankuai.ViewHolder vh, int position)
	{
		
		String title=(String)data.get(position).get("title");
		vh.bk_title.setText(title);

		vh.bk_grid.setAdapter(new AdapterBkMk(context,(List<Map<String,Object>>)data.get(position).get("mk"),title));
		
		// TODO: Implement this method
	}

	@Override
	public int getItemCount()
	{
		// TODO: Implement this method
		return data.size();
	}
	
	
}
